{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li><a href="{php echo web_url('activity/activity_web/categorylist');}">分类列表</a></li>
	<li class="active"><a href="javascript:;">{if $id}编辑{else}新建{/if}分类</a></li>
</ul>
<div class="app-content">
	<div class="app-form">
		<form action="" method="post" class="form-horizontal form form-validate" onsubmit="return formcheck(this);">
			<div class="tab-content">
				<div class="panel panel-default">
					<div class="panel-heading">活动分类</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="col-sm-2 control-label">分类名称<span style="color: orangered;">*</span></label>
							<div class="col-xs-12 col-sm-8">
								<input type="text" name="category[name]" class="form-control" value="{$category['name']}" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">分类图标<span style="color: orangered;">*</span></label>
							<div class="col-md-8">
								{php echo attachment_select('category[logo]',$category['logo']);}
								<span class="help-block">图片建议为80X80</span>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">分类排序</label>
							<div class="col-xs-4 col-sm-9">
								<input type="number" min="0" name="category[sort]" placeholder="数字越大，排序越前" class="form-control" value="{$category['sort']}" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">分类状态</label>
							<div class="col-sm-9">
								<label class="radio-inline">
									<input type="radio"  name="status" value="1" title="启用" {if $category['status'] == 1}checked{/if}> 启用
								</label>
								<label class="radio-inline">
									<input type="radio"  name="status" value="0" title="禁用" {if $category['status'] == 0 || empty($category['status'])}checked{/if}> 禁用
								</label>
							</div>
						</div>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<label class="col-sm-1 control-label"></label>
					<input type="hidden" name="id" value="{$id}" id="id"/>
					<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	function formcheck(){
		if($("input[name='category[name]']").val() == ''){
			layer.alert('请填写分类名称');
			return false;
		}
		if($("input[name='category[logo]']").val() == ''){
			layer.alert('请上传分类图标');
			return false;
		}
		return true;
	}
</script>
{php include wl_template('common/footer');}